/**
 * 
 */
package com.geezdata.cps.ttk.api.controller;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.geezdata.cps.base.annotation.LoggerOut;
import com.geezdata.cps.base.response.BaseResponse;
import com.geezdata.cps.cqrs.command.Command;
import com.geezdata.cps.cqrs.command.bus.CommandBus;
import com.geezdata.cps.ttk.common.request.CreateOrUpdateOpenUserRequest;
import com.geezdata.cps.ttk.common.response.CreateOrUpdateOpenUserResult;


@RestController
@RequestMapping(value="/open_user")
public class OpenUserController {
	@Autowired
    private CommandBus commandBus;
	
	@Autowired
	private Command<CreateOrUpdateOpenUserRequest, CreateOrUpdateOpenUserResult>createOrUpdateOpenUserCommand;

	
	@LoggerOut
    @RequestMapping(value = "/createOrUpdateOpenUser", method = RequestMethod.POST)
    public BaseResponse<CreateOrUpdateOpenUserResult> createOrUpdateOpenUser(@Valid @RequestBody CreateOrUpdateOpenUserRequest request) {
		return commandBus.dispatch(createOrUpdateOpenUserCommand, request);
    }

}
